/**
 * Copyright (c) 2008, Keisuke Inoue, Syracuse Unviersity
 * All rights reserved.
 *
 */
package edu.syr.iis.web.model;

import java.util.Set;
import java.util.HashSet;

/**
 * @author kinoue
 *
 */
public class DialogueActLabel
{
    int dialogueActLabelId;

    DialogueActDimension dialogueActDimension;
    
    String label;    
    String description;
    
    Set<Message> messages = new HashSet();
    Set<DialogueAct> functionDialogueActs = new HashSet();
    Set<DialogueAct> domainDialogueActs = new HashSet();
    
    public void deleteFunctionDialogueAct(int daId)
    {
		HashSet<DialogueAct> newDAs = new HashSet<DialogueAct>();
		System.out.println("Size of dialogueActs: " + functionDialogueActs.size());
		System.out.println("Removing from Set: " + daId);
		
		for (DialogueAct da: this.functionDialogueActs)
		{
			if (da.getDialogueActId() == daId)
				System.out.println("Found the DA ID: " + da.getDialogueActId());
			else
				newDAs.add(da);
		}	
		
		this.functionDialogueActs = newDAs;
		System.out.println("Size of dialogueActs: " + functionDialogueActs.size());
    }
    
    public void deleteDomainDialogueAct(int daId)
    {
		HashSet<DialogueAct> newDAs = new HashSet<DialogueAct>();
		System.out.println("Size of dialogueActs: " + domainDialogueActs.size());
		System.out.println("Removing from Set: " + daId);
		
		for (DialogueAct da: this.domainDialogueActs)
		{
			if (da.getDialogueActId() == daId)
				System.out.println("Found the DA ID: " + da.getDialogueActId());
			else
				newDAs.add(da);
		}	
		
		this.domainDialogueActs = newDAs;
		System.out.println("Size of dialogueActs: " + domainDialogueActs.size());
    }
    
    
    public int getNumLabeled()
    {
	return messages.size();
    }
    
    public int getDialogueActNum()
    {
	return domainDialogueActs.size() + functionDialogueActs.size();
    }
    
    public Set<DialogueAct> getFunctionDialogueActs()
    {
        return functionDialogueActs;
    }
    
    public void setFunctionDialogueActs(Set<DialogueAct> dialogueActs)
    {
	this.functionDialogueActs = dialogueActs;
    }

    public Set<DialogueAct> getDomainDialogueActs()
    {
        return domainDialogueActs;
    }
    
    public void setdomainDialogueActs(Set<DialogueAct> dialogueActs)
    {
	this.domainDialogueActs = dialogueActs;
    }

    
    public Set<Message> getMessages()
    {
        return messages;
    }
    
    public void setMessages(Set<Message> messages)
    {
	this.messages = messages;
    }
    
    public int getDialogueActLabelId()
    {
        return dialogueActLabelId;
    }
    public DialogueActDimension getDialogueActDimension()
    {
        return dialogueActDimension;
    }
    public void setDialogueActDimension(DialogueActDimension dialogueActDimension)
    {
        this.dialogueActDimension = dialogueActDimension;
    }
    public String getLabel()
    {
        return label;
    }
    public String getDescription()
    {
        return description;
    }
    public void setDialogueActLabelId(int dialogueActLabelId)
    {
        this.dialogueActLabelId = dialogueActLabelId;
    }
    public void setLabel(String label)
    {
        this.label = label;
    }
    public void setDescription(String description)
    {
        this.description = description;
    } 

	public String getLabelClass()
	{
		return label.toLowerCase().substring(0, 4);		
	}
	
    /*
     * See if it helps form:checkbox to work...
     */
    
    /*
    @Override
    public boolean equals(Object obj)
    {
	// TODO Auto-generated method stub
	DialogueActLabel dalabel = (DialogueActLabel) obj;
	
	return (dalabel.getDialogueActLabelId() == dialogueActLabelId); 
    }
*/
    
    

}
